package com.wskj.shiro;

import com.wskj.pojo.User;

public class Login {
	public static void main(String[] args) {
		/*new UserDao().createUser("zhang3", "12345");
		System.out.println("注册成功");*/
		
		User user = new User();
		user.setPassword("12345");
		user.setUsername("zhang3");
		
		if(util.login(user)){
			System.out.println("登录成功");
			if(util.isPermitted("addOrder")){
				System.out.println(user.getUsername()+"拥有权限");
			}else{
				System.out.println("没有权限");
			}
			if(util.hasRole("productManager")){
				System.out.println(user.getUsername()+"拥有角色");
			}else{
				System.out.println("没有此角色");
			}
		}else{
			System.out.println("登录失败");
		}
		
		
	}

}
